package com.newtouch.bxzs.policy.controller;

import com.newtouch.bxzs.policy.model.vo.InsuranceNoticeVO;
import com.newtouch.bxzs.policy.model.vo.RenewalNoticeVO;
import com.newtouch.bxzs.policy.model.vo.SuccessfulSurrenderNoticeVO;
import com.newtouch.bxzs.policy.model.vo.SurrenderNoticeVO;
import com.newtouch.bxzs.policy.service.PolicyNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 保单各类通知信息
 *
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/2/3 14:01</td>
 * <td>linhongxi</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author linhongxi
 * @version 1.0.0
 * @since 1.0.0
 */
@Api(tags = "保单通知接口")
@RestController
@RequestMapping("/policyNotice")
public class PolicyNoticeController {
	/** 静态变量：系统日志 */
	private static final Log logger = LogFactory.getLog(PolicyNoticeController.class);

	@Resource
	private PolicyNoticeService policyNoticeService;

	@ApiOperation(value = "接收投保成功通知接口")
	@PostMapping("/getSuccessfulInsuranceNotice")
	public boolean successfulInsuranceNotice(@RequestBody InsuranceNoticeVO insuranceNoticeVO) {
		logger.info("调用投保成功通知接口");
		return policyNoticeService.successfulInsuranceNotice(insuranceNoticeVO);
	}

	@ApiOperation(value = "保险端退保申请通知接口")
	@PostMapping("/getSurrenderApplicationNotice")
	public boolean surrenderApplicationNotice(@RequestBody SurrenderNoticeVO surrenderNoticeVO) {
		logger.info("调用保险端退保申请通知接口");
		return policyNoticeService.surrenderApplicationNotice(surrenderNoticeVO);
	}

	@ApiOperation(value = "保险端退保成功通知接口")
	@PostMapping("/getSuccessfulSurrenderNotice")
	public boolean successfulSurrenderNotice(@RequestBody SuccessfulSurrenderNoticeVO successfulSurrenderNoticeVO) {
		logger.info("调用保险端退保成功通知接口");
		return policyNoticeService.successfulSurrenderNotice(successfulSurrenderNoticeVO);
	}

	@ApiOperation(value = "保险端通知续期保单接口")
	@PostMapping("/getRenewalNotice")
	public boolean renewalNotice(@RequestBody RenewalNoticeVO renewalNoticeVO) {
		logger.info("调用保险端通知续期保单接口");
		return policyNoticeService.renewalNotice(renewalNoticeVO);
	}

	@ApiOperation(value = "保险端通知满期保单接口")
	@PostMapping("/getExpirationNotice")
	public boolean expirationNotice(@RequestBody InsuranceNoticeVO insuranceNoticeVO) {
		logger.info("调用保险端通知满期保单接口");
		return policyNoticeService.expirationNotice(insuranceNoticeVO);
	}

}
